home *** CD-ROM | disk | FTP | other *** search
/ Eagles Nest BBS 8 / Eagles_Nest_Mac_Collection_Disc_8.TOAST / Developer Tools⁄Additions / Mandlebrot / Mandlebrot Folder / Menu.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-09  |  4.3 KB  |  170 lines  |  [TEXT/KAHL]

  1. /* *********************************************************************************
  2.      
  3.       FILE:            Menu.c
  4.       
  5.      DESCRIPTION:    Simple menu processing. Use the File Menu slot to do the Mandelbrot
  6.                     parameter selection
  7.                       
  8.      AUTHOR:        Bruce E. Gladstone
  9.      
  10.      Copyright © 1990 by Bruce E. Gladstone, All Rights Reserved.
  11.      
  12.      Revision History:
  13.      ============================================================
  14.      5/1/90    - Release to Compuserve
  15.      ============================================================
  16.      
  17.      COMMENTS:
  18.      
  19.      None. 
  20.  
  21.    ******************************************************************************** */
  22.            
  23. #include <stdio.h> 
  24. #include <MacTypes.h> 
  25. #include <WindowMgr.h>
  26. #include <MenuMgr.h>
  27. #include <EventMgr.h>
  28. #include <ToolboxUtil.h> 
  29. #include <ControlMgr.h>
  30. #include <color.h>
  31. #include <colortoolbox.h>
  32. #include "Mandelbrot.h"
  33.  
  34.  
  35. /* ---------------------------- Global Variables ---------------------------------- */
  36.  
  37. extern int                colorQD;
  38. extern int                quitFlag;
  39. extern int                linearFlag;
  40. extern int                custPict;
  41. extern int                numColorBits;
  42. extern int                numColors, brushSize;
  43. extern int                limit;
  44. extern int                n;
  45. extern long                startTime, now;
  46. extern float            res;
  47. extern float            centx, centy;
  48. extern float            xmin, xmax, ymin, ymax;
  49. extern float            delx, dely;
  50.  
  51. /* ---------------------------- Global MacTypes ----------------------------------- */
  52.  
  53. extern Str255            str;
  54. extern CTabHandle        myColorHandle;
  55. extern RGBColor            aColor;
  56. extern Rect                myRect, dragRect;
  57. extern WindowPtr        aboutWindow;        
  58. extern MenuHandle        appleMenu, mandelMenu, editMenu, xMenu, yMenu, resMenu, timeMenu;
  59. extern WindowPtr        myWindow;
  60.  
  61. /* ---------------------------  Local Prototypes  --------------------------------- */
  62.  
  63. void doMenu ( long );
  64. void aboutDialog ( void );
  65.  
  66. /* --------------------------------------------------------------------------------
  67.     doMenu - 5/01/90 beg
  68.    -------------------------------------------------------------------------------- */
  69.  
  70. void
  71. doMenu         ( mResult )
  72. long            mResult;
  73.  
  74. {
  75.     int        theItem;
  76.     int     theMenu;
  77.     int        temp;
  78.     
  79.     theMenu = HiWord ( mResult );
  80.     theItem = LoWord ( mResult );
  81.     switch ( theMenu )
  82.     {
  83.         case appleID:
  84.             if ( theItem == 1 )
  85.             {
  86.                 aboutDialog ();
  87.             }
  88.             else
  89.             {
  90.                 GetItem ( appleMenu, theItem, str );
  91.                 temp = OpenDeskAcc ( str );
  92.                 SetPort ( myWindow );
  93.             }
  94.             break;
  95.         case mandelID:
  96.             switch ( theItem )
  97.             {
  98.                 case 1:
  99.                     limit = 64;
  100.                     CheckItem ( mandelMenu, 1, TRUE );
  101.                     CheckItem ( mandelMenu, 2, FALSE );
  102.                     CheckItem ( mandelMenu, 3, FALSE );
  103.                     break;
  104.                 case 2:
  105.                     limit = 256;
  106.                     CheckItem ( mandelMenu, 2, TRUE );
  107.                     CheckItem ( mandelMenu, 1, FALSE );
  108.                     CheckItem ( mandelMenu, 3, FALSE );
  109.                     break;
  110.                 case 3:
  111.                     limit = 1024;
  112.                     CheckItem ( mandelMenu, 3, TRUE );
  113.                     CheckItem ( mandelMenu, 1, FALSE );
  114.                     CheckItem ( mandelMenu, 2, FALSE );
  115.                     break;
  116.                 case 5:
  117.                     linearFlag = FALSE;
  118.                     CheckItem ( mandelMenu, 5, TRUE );
  119.                     CheckItem ( mandelMenu, 6, FALSE );
  120.                     break;
  121.                 case 6:
  122.                     linearFlag = TRUE;
  123.                     CheckItem ( mandelMenu, 6, TRUE );
  124.                     CheckItem ( mandelMenu, 5, FALSE );
  125.                     break;
  126.                 case 8:
  127.                     brushSize = 1;
  128.                     CheckItem ( mandelMenu, 8, TRUE );
  129.                     CheckItem ( mandelMenu, 9, FALSE );
  130.                     CheckItem ( mandelMenu, 10, FALSE );
  131.                     CheckItem ( mandelMenu, 11, FALSE );
  132.                     break;
  133.                 case 9:
  134.                     brushSize = 2;
  135.                     CheckItem ( mandelMenu, 8, FALSE );
  136.                     CheckItem ( mandelMenu, 9, TRUE );
  137.                     CheckItem ( mandelMenu, 10, FALSE );
  138.                     CheckItem ( mandelMenu, 11, FALSE );
  139.                     break;
  140.                 case 10:
  141.                     brushSize = 4;
  142.                     CheckItem ( mandelMenu, 8, FALSE );
  143.                     CheckItem ( mandelMenu, 9, FALSE );
  144.                     CheckItem ( mandelMenu, 10, TRUE );
  145.                     CheckItem ( mandelMenu, 11, FALSE );
  146.                     break;
  147.                 case 11:
  148.                     brushSize = 8;
  149.                     CheckItem ( mandelMenu, 8, FALSE );
  150.                     CheckItem ( mandelMenu, 9, FALSE );
  151.                     CheckItem ( mandelMenu, 10, FALSE );
  152.                     CheckItem ( mandelMenu, 11, TRUE );
  153.                     break;
  154.                 case 13:
  155.                     quitFlag = TRUE;
  156.                     break;
  157.             }
  158.             break;
  159.             case editID:
  160.                 temp = (int)SystemEdit ( theItem - 1 );
  161.                 break;
  162.     }
  163.     HiliteMenu ( 0 );
  164. }  /*   doMenu         ( mResult )   */
  165.  
  166. /* ===============================  EOF  ==========================================
  167.     Copyright © 1990 by Bruce E. Gladstone, All Rights Reserved.
  168.    ================================================================================ */
  169.  
  170.